#include "IterationStmt.h"
#include "../Expressions/Expression.h"
#include "Statement.h"
#include "../Declarations/Declaration.h"

IterationStmt::~IterationStmt(void)
{
	switch(m_iType)
	{
	case do_stmt:
	case while_stmt:
		delete m_pDoStmt;
		delete m_pWhileExpr;
		break;
	case for_stmt:
		delete m_pExpr1;
		delete m_pExpr2;
		delete m_pExpr3;
		delete m_pForStmt;
	case decl_for_stmt:
		delete m_pDecl;
		delete m_pExpr2;
		delete m_pExpr3;
		delete m_pForStmt;
	default:
		assert(0);
		
	}
}

void IterationStmt::codeGen()
{
	COUT
		switch(m_iType)
	{
		case do_stmt:
		case while_stmt:
			m_pDoStmt->codeGen();
			m_pWhileExpr->codeGen();
			break;
		case for_stmt:
			m_pExpr1->codeGen();
			m_pExpr2->codeGen();
			m_pExpr3->codeGen();
			m_pForStmt->codeGen();
		case decl_for_stmt:
			m_pDecl->codeGen();
			m_pExpr2->codeGen();
			m_pExpr3->codeGen();
			m_pForStmt->codeGen();
		default:
			assert(0);

	}

}